import {request} from "@/network/request";
import {formatDate} from "@/common/utils";

//删除订单
export function deleteOrder(id){
  return request({
    url:'/api/admin/deleteOrder',
    method: 'get',
    params:{id}
  })
}

//获取所有的订单
export function getAllOrder(){
  return request({
    url:'/api/admin/getAllOrder'
  })
}
//多条件查询订单
export function getOrderByKey(search){
  return request({
    url:'/api/admin/getOrderByKey',
    method: 'post',
    data:{
      id:search.id,
      kind:search.kind,
      accept:search.accept,
      type:search.type,
      pay:search.pay,
      timeBeginRange:search.timeBeginRange==''?search.timeBeginRange :formatDate(search.timeBeginRange, "yyyy-MM-dd"),
      timeEndRange:search.timeEndRange==''?search.timeEndRange :formatDate(search.timeEndRange, "yyyy-MM-dd")
    }
  })
}
//受理订单
export function acceptOrder(id){
  return request({
    url:'/api/admin/acceptOrder',
    method:'get',
    params:{
      id
    }
  })
}

//拒绝受理
export function notAcceptOrder(id){
  return request({
    url:'/api/admin/notAcceptOrder',
    method: 'get',
    params:{id}
  })
}
